package haonan3344.webcheater.getProxyLists;

import java.io.*;

import haonan3344.localbbs.conf.*;
import haonan3344.webcheater.core.Proxy;
import haonan3344.webcheater.core.ProxyList;

public class GetProxyFromFile extends GetProxyBase {

	public GetProxyFromFile(String filename) {
		this.filename = filename;
	}

	@Override
	public ProxyList getProxyList() {
		
		File file = new File(filename);
        BufferedReader reader = null;
        
        try {
			reader = new BufferedReader(new FileReader(file));
			String line=null;
			while ((line = reader.readLine()) != null) {
				Proxy p = new Proxy(line);
				proxyList.addProxy(p);
            }
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return proxyList;
	}
	
	private String filename;

}
